package com.ssy.lingxi.pay.api.feign;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.pay.api.dto.request.eAccount.*;
import com.ssy.lingxi.pay.api.fallback.AliPayHystrix;
import com.ssy.lingxi.pay.api.model.vo.response.allInPay.ApplicationTransferRespVO;
import com.ssy.lingxi.pay.api.model.vo.response.allInPay.OrderSplitRefundRespVO;
import com.ssy.lingxi.pay.api.model.vo.response.allInPay.RefundRespVO;
import com.ssy.lingxi.pay.api.model.vo.response.allInPay.SignalAgentPayRespVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;
import java.util.List;

/**
 * 通联支付内部接口
 *
 * @author lqa
 * @version 2.0.0
 * @date 2021/12/5
 */
@FeignClient(value = "pay-service", fallback = AliPayHystrix.class)
public interface IAllInPayFeign {

    /**
     * 订单预支付
     * @param eAccountOrderPayRequest 接口参数
     */
    @RequestMapping(value = "/pay/allInPay/orderPay", method = RequestMethod.POST)
    Wrapper<String> orderPay(@RequestBody @Valid EAccountOrderPayRequest eAccountOrderPayRequest);

    /**
     * 平台代付
     * @param platFormRePayRequest 参数
     */
    @RequestMapping(value = "/pay/allInPay/platFormRePay", method = RequestMethod.POST)
    Wrapper<SignalAgentPayRespVO> platFormRePay(@RequestBody @Valid PlatFormRePayRequest platFormRePayRequest);

    /**
     * 平台转账
     * @param platFormTransferRequest 参数
     */
    @RequestMapping(value = "/pay/allInPay/platFormTransfer", method = RequestMethod.POST)
    Wrapper<ApplicationTransferRespVO> platFormTransfer(@RequestBody @Valid PlatFormTransferRequest platFormTransferRequest);

    /**
     * 退款申请(1-会员直接到账; 2-平台代收并且平台还没结算给商家)
     * @param eAccountRefundRequest 参数
     */
    @RequestMapping(value = "/pay/allInPay/orderRefund", method = RequestMethod.POST)
    Wrapper<RefundRespVO> orderRefund(@RequestBody @Valid EAccountRefundRequest eAccountRefundRequest);

    /**
     * 退款申请(平台代收并且平台已经结算给商家)
     * @param storeRefundRequest 参数
     */
    @RequestMapping(value = "/pay/allInPay/orderStoreRefund", method = RequestMethod.POST)
    Wrapper<OrderSplitRefundRespVO> orderStoreRefund(@RequestBody @Valid StoreRefundRequest storeRefundRequest);

    /**
     * 缓存通联配置参数
     * @param cacheParamsRequest 参数
     */
    @RequestMapping(value = "/pay/allInPay/cacheParams", method = RequestMethod.POST)
    Wrapper<Void> cacheParams(@RequestBody @Valid List<CacheParamsRequest> cacheParamsRequest);
}
